Skip to content

Correct millis() error causes by micros() overflow every about 72 minutes #2438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 14, 2019
Merged

Correct millis() error causes by micros() overflow every about 72 minutes #2438

merged 1 commit into from
Feb 14, 2019

Conversation

Jeroen88
Copy link
Contributor

@Jeroen88 Jeroen88 commented Feb 8, 2019

Corrects issue #2430, thanks to @stickbreaker for the very easy solution found!

This solution is very different from the ESP8266 solution, because on that controller the micros() timer used to calculate millis() is a 32 bit wide counter. On the ESP32 the micros() base counter is 64 bits wide, allowing the solution to be both fast and simple. As I understand from reading topics on the internet, the division by 1,000 needed in this solution should be optimised by the gcc compiler using the same magic number method as in the ESP8266.

The new millis() function was tested (only) one loop of 72 minutes, without an issue.

@me-no-dev me-no-dev merged commit 71ec3c3 into espressif:master Feb 14, 2019
everslick added a commit to everslick/Arduino-ESP32-1.0.0 that referenced this pull request Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants